import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class App extends JFrame{
    private JButton btn_newGame;
    private JPanel mainPanel;

    public App(String title) {

        this.setTitle(title);
        this.setContentPane(this.mainPanel);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.pack();
        this.setVisible(true);

        btn_newGame.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                // 打开新窗体
                new MainFrame("PK RPG");
                // 关闭当前窗体
                dispose();
            }
        });
    }

    public static void main(String[] args){
        new App("PK RPG");
    }
}
